package com.dwjf.festec;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Toast;

import com.dwjf.core.delegates.LatteDelegate;
import com.dwjf.core.net.RestClient;
import com.dwjf.core.net.callbak.Failure;
import com.dwjf.core.net.callbak.Success;

public class ExampleDelegate extends LatteDelegate {

    @Override
    public Object setLayout() {
        Object view = R.layout.delegate_example;
        System.err.print(view);
        return view;
    }

    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {
        restClient();
    }


    private void restClient(){
        System.out.print("jwejkdwqeoowjdmeqwiujdnhqwihndqiujwsn");
        RestClient.build()
                .url("https://hao.360.cn/?a1004")
                .params("","")
                .loader(getContext())
                .success(new Success() {
                    @Override
                    public void onSuccess(String response) {
                        Toast.makeText(getContext(), response, Toast.LENGTH_LONG).show();
                    }
                })
                .failuer(new Failure() {
                    @Override
                    public void onFailure() {

                    }
                })
                .build();
    }
}
